package com.briup.estore.mapper;

import java.math.BigInteger;
import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;

import com.briup.estore.bean.Address;

@Mapper
public interface IAddressMapper {

	@Select("select id,receivename ,address,phone,customer_id from es_address where customer_id = #{customer_id}")
	List<Address> selectAddressesNyCustomerId(BigInteger customer_id);

	@Insert("insert into es_address(id,receivename,address,phone,customer_id)"
			+ " values(#{id},#{receivename},#{address},#{phone},#{customer_id})")
	@SelectKey(statement = "select my_seq.nextval from dual", keyProperty = "id", resultType = BigInteger.class, before = true)
	int insertAddress(Address address);
}
